<!--
 * @Descripttion: 封装动态表头
 * @version: 
 * @Author: zhangfan
 * @email: 2207044692@qq.com
 * @Date: 2020-07-03 17:35:37
 * @LastEditors: younghxp
 * @LastEditTime: 2022-02-24 15:35:47
-->
<template>
  <!-- <el-table-column  :formatter="formatTd" :prop="col.prop" :fixed="col.prop==='date'||col.prop==='projectName'||col.prop == 'bankNameDesc'" :width="col.prop==='date'?350:'auto'" :label="col.label" v-if="col.isShow" align="center">
    <template v-if="col.children">
      <el-table-column
        v-for="(items,indexs) in activeUser"
        :formatter="formatTd"
        :key="indexs"
        :min-width="items.prop==='industryName'||items.prop==='investmentName'?100:150"
        :prop="items.prop"
        :label="items.label"
      ></el-table-column>
    </template>
  </el-table-column> -->
  <el-table-column
    :sortable="sortable"
    :formatter="formatTd"
    :property="col.prop"
    :fixed="
      col.prop === 'date' ||
      col.prop === 'projectName' ||
      col.prop == 'bankNameDesc'
    "
    :min-width="
      col.prop === 'projectName' ||
      col.prop === 'accountName' ||
      col.prop === 'pbName' ||
      col.prop === 'remark' ||
      col.prop === 'serialNo'
        ? 230
        : 240
    "
    :label="col.label"
    v-if="col.isShow"
    :align="
      col.prop === 'projectName' ||
      col.prop === 'accountName' ||
      col.prop === 'pbName' ||
      col.prop === 'remark' ||
      col.prop === 'serialNo' ||
      col.prop === 'bankName'
        ? 'left'
        : 'center'
    "
  >
    <template slot-scope="scope">
      <div v-if="col.prop == 'projectName'">
        <copyText
          :tableIndex="scope.$index"
          :copyTextName="scope.row[scope.column.property]"
          :columnName="'projectName'"
        ></copyText>
      </div>
      <div v-else-if="col.prop == 'accountName'">
        <copyText
          :tableIndex="scope.$index"
          :copyTextName="scope.row[scope.column.property]"
          :columnName="'accountName'"
        ></copyText>
      </div>
      <div v-else-if="col.prop == 'pbName'">
        <copyText
          :tableIndex="scope.$index"
          :copyTextName="scope.row[scope.column.property]"
          :columnName="'pbName'"
        ></copyText>
      </div>
      <div v-else-if="col.prop == 'remark'">
        <copyText
          :tableIndex="scope.$index"
          :copyTextName="scope.row[scope.column.property]"
          :columnName="'remark'"
        ></copyText>
      </div>
      <div v-else-if="col.prop == 'serialNo'">
        <copyText
          :tableIndex="scope.$index"
          :copyTextName="scope.row[scope.column.property]"
          :columnName="'serialNo'"
        ></copyText>
      </div>
      <div v-else>
        <span>{{
          scope.row[scope.column.property] !== 0
            ? scope.row[scope.column.property] || '--'
            : 0
        }}</span>
      </div>
    </template>
    <template v-if="col.children">
      <el-table-column
        v-for="(items, indexs) in activeUser"
        :formatter="formatTd"
        :key="indexs"
        :min-width="
          items.prop === 'industryName' || items.prop === 'investmentName'
            ? 100
            : 150
        "
        :prop="items.prop"
        :label="items.label"
      ></el-table-column>
    </template>
  </el-table-column>
</template>

<script>
export default {
  name: 'MyColumn',
  props: {
    col: {
      type: Object,
    },
    sortable: {
      default: false,
    },
  },
  mounted() {
    console.log(123, this.col)
  },
  computed: {
    activeUser: function () {
      const vm = this
      if (vm.col.children) {
        let users = vm.col.children
        return users.filter(function (user) {
          return user.isShow
        })
      }
    },
  },
}
</script>
<style scoped></style>
